home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: babycox@aol.com (BabyCox)
- Newsgroups: comp.lang.c
- Subject: Re: quick decision: is n a power of 2?
- Date: 20 Jan 1996 22:02:48 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4dsaco$a39@newsbf02.news.aol.com>
- References: <4dpd94$c25@fountain.mindlink.net>
- Reply-To: babycox@aol.com (BabyCox)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- I'm sorry,
-
- Here is a revision, this should work (but that's what I said last time)
-
- Boolean isPowerOfTwo(long x)
- {
- long tst;
- for(tst=1<<31;tst!=0;tst>>=1)
- if (x==tst) return true;
-
- return false;
- }
-